<?php
/**
 * Created by PhpStorm.
 * User: function
 * Date: 2018-05-04
 * Time: 17:38
 */

namespace app\api\controller\seller;
use app\common\controller\Api;

use app\common\model\Member;
use app\common\model\Company;
use app\common\model\Amount;
use app\common\model\Withdraw;

class User extends Api
{
    /**
     * 余额变动列表
     */
    public function amountRecord(){
        
        
        $pararms = paramForm();
        $sellerId = $this->getUserId();
        $seller = Member::get($sellerId);
        $filter = [
            'user_id'=>$seller->id,
        ];
        
        if(isset($pararms['action'])){
            
            switch ($pararms['action']){
                case 'plus':
                    $filter['action'] = 1;
                    break;
                case 'minus':
                    $filter['action'] = -1;
                    break;
                default:
                    //啥也不干
                    break;
            }
        }
        
        $list = Amount::where($filter)->order('create_time desc')->paginate(20);
        success($list);
        
    }
    
}